﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace OCR
{
    //卡片定义信息
    public class CardType
    {
        private string name;
        /// <summary>
        /// 卡片名称
        /// </summary>
        public string Name
        {
            get
            {
                if (string.IsNullOrEmpty(this.name))
                {
                    return this.faceValue + "(" + this.faceValue + ")";
                }
                return name;
            }
            set { name = value; }
        }
        private string factoryName;
        /// <summary>
        /// 运营商
        /// </summary>
        public string FactoryName
        {
            get { return factoryName; }
            set { factoryName = value; }
        }
        private string faceValue;
        /// <summary>
        /// 面值
        /// </summary>
        public string FaceValue
        {
            get { return faceValue; }
            set { faceValue = value; }
        }
        private DateTime validDate;
        /// <summary>
        /// 有效期
        /// </summary>
        public DateTime ValidDate
        {
            get { return validDate; }
            set { validDate = value; }
        }


        private int noCount;
        /// <summary>
        /// 卡号位数
        /// </summary>
        public int NoCount
        {
            get { return noCount; }
            set { noCount = value; }
        }
        private int pwCount;
        /// <summary>
        /// 密码位数
        /// </summary>
        public int PwCount
        {
            get { return pwCount; }
            set { pwCount = value; }
        }

        private RecognitionDefine noRecognition = new RecognitionDefine();
        /// <summary>
        /// 卡号识别
        /// </summary>
        public RecognitionDefine NoRecognition
        {
            get { return noRecognition; }
            set { noRecognition = value; }
        }
        private RecognitionDefine pwRecognition = new RecognitionDefine();
        /// <summary>
        /// 密码识别
        /// </summary>
        public RecognitionDefine PwRecognition
        {
            get { return pwRecognition; }
            set { pwRecognition = value; }
        }
    }
    //识别定义类
    public class RecognitionDefine
    {
        private 识别方法 type = 识别方法.字符;

        public 识别方法 Type
        {
            get { return type; }
            set { type = value; }
        }
       
        /// <summary>
        /// 是否条形码识别
        /// </summary>

        private CharRecognition charRecognition = new CharRecognition();
        /// <summary>
        /// 字符识别
        /// </summary>
        public CharRecognition CharRecognition
        {
            get { return charRecognition; }
            set { charRecognition = value; }
        }
        private CharRecognition barCodeRecognition = new CharRecognition();
        /// <summary>
        /// 条形码识别
        /// </summary>
        public CharRecognition BarCodeRecognition
        {
            get { return barCodeRecognition; }
            set { barCodeRecognition = value; }
        }
       

    }
    /// <summary>
    /// 字符识别定义类
    /// </summary>
    public class CharRecognition
    {
        private string font = "eng";

        public string Font
        {
            get { return font; }
            set { font = value; }
        }

        private bool recognitionNum = true;
        /// <summary>
        /// 数字
        /// </summary>
        public bool RecognitionNum
        {
            get
            {
                return this.recognitionNum;
            }
            set
            {
                this.recognitionNum = value;
            }
        }

        private bool recognitionChar = false;
        /// <summary>
        /// 字母
        /// </summary>

        public bool RecognitionChar
        {
            get { return recognitionChar; }
            set { recognitionChar = value; }
        }
        /// <summary>
        /// 识别字符串范围
        /// </summary>
        public string RecognitionStr
        {
            get
            {
                string tempStr = "";
                if (this.RecognitionNum)
                {
                    tempStr = "0123456789";
                }
                if (this.RecognitionChar)
                {
                    tempStr += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
                }
                return tempStr;
            }
        }
        private Rectangle region = new Rectangle();
        /// <summary>
        /// 区域
        /// </summary>
        public Rectangle Region
        {
            get { return this.region; }
            set { this.region = value; }
        }
        private bool noiseClear = true;
        /// <summary>
        /// 是否去噪点处理
        /// </summary>
        public bool NoiseClear
        {
            get { return noiseClear; }
            set { noiseClear = value; }
        }
    }
    /// <summary>
    /// 条形码识别定义类
    /// </summary>
    public class BarCodeRecognition
    {
        private Rectangle region;
        /// <summary>
        /// 区域
        /// </summary>
        public Rectangle Region
        {
            get { return region; }
            set { region = value; }
        }
        private bool noiseClear = true;
        /// <summary>
        /// 是否去噪点处理
        /// </summary>
        public bool NoiseClear
        {
            get { return noiseClear; }
            set { noiseClear = value; }
        }
       
    }


    public class MyRectangle
    {
        private int x;

        public int X
        {
            get { return x; }
            set { x = value; }
        }
        private int y;

        public int Y
        {
            get { return y; }
            set { y = value; }
        }
        private int width;

        public int Width
        {
            get { return width; }
            set { width = value; }
        }
        private int height;

        public int Height
        {
            get { return height; }
            set { height = value; }
        }
    }
}
